﻿using System;
using System.Collections.Generic;
using UnityEngine;

namespace ProjScan.ScanGUI.Tools
{
	// Token: 0x0200025B RID: 603
	internal class DrawRuleState
	{
		// Token: 0x06001059 RID: 4185 RVA: 0x00007E1A File Offset: 0x0000601A
		public void Begin()
		{
			this.isBegin = true;
			this.isChanged = GUI.changed;
			GUI.changed = false;
		}

		// Token: 0x0600105A RID: 4186 RVA: 0x0004A288 File Offset: 0x00048488
		public bool End()
		{
			bool flag = !this.isBegin;
			if (flag)
			{
				throw new Exception("Not begin");
			}
			bool changed = GUI.changed;
			GUI.changed |= this.isChanged;
			this.isBegin = false;
			return changed;
		}

		// Token: 0x0600105B RID: 4187 RVA: 0x0004A2D4 File Offset: 0x000484D4
		public static void Initialize(int count)
		{
			bool flag = count + 1 > DrawRuleState.ruleList.Count;
			if (flag)
			{
				int num = count + 1 - DrawRuleState.ruleList.Count;
				for (int i = 0; i < num; i++)
				{
					DrawRuleState.ruleList.Add(new DrawRuleState());
				}
			}
			DrawRuleState.ruleList[count].Begin();
		}

		// Token: 0x0600105C RID: 4188 RVA: 0x0004A33C File Offset: 0x0004853C
		public static bool EndRule(int index)
		{
			return DrawRuleState.ruleList[index].End();
		}

		// Token: 0x040009A5 RID: 2469
		private bool isBegin = false;

		// Token: 0x040009A6 RID: 2470
		private bool isChanged = false;

		// Token: 0x040009A7 RID: 2471
		private static List<DrawRuleState> ruleList = new List<DrawRuleState>();
	}
}
